<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form id="form1" action="http://www.baidu.com" onsubmit="return checkForm()">
    <input type="text" id="username" name="wd">
    <select>
        <option>请选择</option>
        <option>aa</option>
        <option>bb</option>
        <option>cc</option>
    </select>
    <input type="submit">
</form>
<script>
    function checkForm(){
        if(document.getElementById('username').value==''){
            alert('请填写用户名');
            document.getElementById('username').focus();
            return false;
        }
        return true
    }
</script>
</body>
</html>